﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;

namespace SelfMadeMillionaire.Core
{
	public static class FileLink
	{
		private static string _fileStoreUrl = ConfigurationManager.AppSettings["PdfFilesStoreUrl"];
		private static string _fileStorePath = ConfigurationManager.AppSettings["PdfFilesStorePath"];

		public static string GetAbsoluteLinkOnFile(string fileName)
		{
			if (string.IsNullOrWhiteSpace(fileName))
				return null;

			return Path.Combine(_fileStoreUrl, fileName);
		}

		public static string GetSaveFilePath(string fileName)
		{
			if (!Directory.Exists(_fileStorePath))
				Directory.CreateDirectory(_fileStorePath);

			return Path.Combine(_fileStorePath, fileName);
		}
	}
}
